home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Learn Microsoft Visual Basic 6.0 Now
/
Learn Microsoft Visual Basic 6.0 Now (Microsoft Press)(X03-58607)(1998).ISO
/
media
/
chap06
/
b06d010.cc2
< prev
next >
Wrap
Text File
|
1998-06-07
|
2KB
|
36 lines
0, One of the slickest examples of the
4, Timer control is a digital clock that you
6, can create by setting properties and
8, typing only one line of program code. First,
13, we'll click the Timer control in the
14, Visual Basic toolbox and create a timer
16, object on our form. Like common dialog
21, objects, timer objects only come in one
23, size, and they're are not visible when the
25, program runs. So, you may want to move
27, them to an out-of-the-way corner on your
28, form. Since this is a clock, we'll resize
33, the Form window, so it looks more like
35, a pop-up window. And we'll add a label
41, object to display the output of the
43, clock. We'll set the label object's Font
49, property to bold, 24-point type. And we'll
55, set the Alignment property of the label
57, object to Center. To make the title bar
61, look nice, we'll set the Forms title bar
64, Caption property to Digital Clock.
75, Finally, we'll set properties for the timer
77, object. We'll set the Interval to 1,000
81, milliseconds, or 1 second. We'll verify
83, that the Enabled property has been set to
85, True, which starts the timer running
87, when the program starts. Finally, we'll
90, add one line of program code to the Timer
93, event procedure, Label1.Caption = Time,
99, which copies the system time to the
100, label object each time the timer is
102, activated. Now, when we run the program, the
108, clock starts up automatically and displays
110, the running system time. Not bad for a
112, minute's work.
116, END